package com.xyy.saas.payment.adpater.yzh.vo;

import com.xyy.saas.payment.adpater.yzh.BasePay;
import com.xyy.saas.payment.adpater.yzh.constant.ConfigPath;
import com.xyy.saas.payment.util.ApolloUtil;
import lombok.Data;

@Data
public class WxpayOrder extends BasePay<WxpayOrderRequest> {
    @Override
    public WxpayOrderRequest assembleParam() {
        return WxpayOrderRequest.builder()
                .order_id(payNo)
                .dealer_id(ApolloUtil.getProperty(ConfigPath.WX_YZH_DEALERID))
                .broker_id(ApolloUtil.getProperty(ConfigPath.WX_YZH_BROKERID))
                .real_name(realName)
                .id_card(idCard)
                .openid(openid)
                .pay(amount)
                .pay_remark(remark)
                .notify_url(ApolloUtil.getProperty(ConfigPath.WX_PAY_RESULT_NOTIFY_URL))
                .wx_app_id(appId)
                .wxpay_mode("transfer")
                .build();
    }

    /**
     * 支付流水号
     */
    private String payNo;
    /**
     * 真实姓名
     */
    private String realName;
    /**
     * 身份证号
     */
    private String idCard;
    /**
     * openid
     */
    private String openid;
    /**
     * 微信APPID
     */
    private String appId;
    /**
     * 金额，元
     */
    private String amount;
    /**
     * 备注，小于20字符
     */
    private String remark;

    /**
     * 构建对象
     * @param payNo
     * @param realName
     * @param idCard
     * @param openid
     * @param amount
     * @param remark
     * @return
     */
    public static WxpayOrder build(String payNo, String realName, String idCard, String openid, String appId, String amount, String remark) {
        WxpayOrder wxpayOrder = new WxpayOrder();
        wxpayOrder.setPayNo(payNo);
        wxpayOrder.setRealName(realName);
        wxpayOrder.setIdCard(idCard);
        wxpayOrder.setOpenid(openid);
        wxpayOrder.setAppId(appId);
        wxpayOrder.setAmount(amount);
        wxpayOrder.setRemark(remark);
        return wxpayOrder;
    }
}
